package com.ljf.config.api.service.impl;

import com.ljf.common.api.service.impl.BasisServiceImpl;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.result.ServiceResultModel;
import com.ljf.common.utils.ServiceResultUtil;
import com.ljf.config.domain.repository.ConfigBaseImpulseSenderHeaderRepository;
import com.ljf.config.domain.service.ConfigBaseImpulseSenderHeaderDomainService;
import com.ljf.config.domain.validator.ConfigBaseImpulseSenderHeaderValidator;
import com.ljf.config.dto.command.ConfigBaseImpulseSenderHeaderCommand;
import com.ljf.config.dto.command.ConfigDatImpulseSenderConditionCommand;
import com.ljf.config.dto.query.ConfigBaseImpulseSenderHeaderQuery;
import com.ljf.config.model.ConfigBaseImpulseSenderHeader;
import com.ljf.config.service.IConfigBaseImpulseSenderHeaderService;
import com.ljf.config.vo.ConfigBaseImpulseSenderHeaderVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 发号器配置表头  服务接口实现
 *
 * @author LJF
 * @since 2025-01-09
 */
@Service
public class ConfigBaseImpulseSenderHeaderServiceImpl extends BasisServiceImpl<ConfigBaseImpulseSenderHeaderDomainService, ConfigBaseImpulseSenderHeaderValidator, ConfigBaseImpulseSenderHeaderRepository, ConfigBaseImpulseSenderHeaderQuery, ConfigBaseImpulseSenderHeaderVO, ConfigBaseImpulseSenderHeader, ConfigBaseImpulseSenderHeaderCommand> implements IConfigBaseImpulseSenderHeaderService {

    /**
     * 初始化发号器配置
     *
     * @param command
     * @return
     * @throws ServiceException
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ServiceResultModel intiCondition(ConfigDatImpulseSenderConditionCommand command) throws ServiceException {
        validator.checkIntiCondition(command);
        return domainService.intiCondition(command) ? ServiceResultUtil.success("初始化成功") : ServiceResultUtil.fail("初始化失败");
    }

}
